/**
 * 
 */
package com.et114.components.ehcache;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

/*
 * @author guanhw
 * 	<context-param>
		<param-name>webAppRootKey</param-name>
		<param-value>WC</param-value>
	</context-param>
 */
public class EhcacheInitListener implements ServletContextListener {
	private String webAppRootKey = "webAppRootKey" ; 
	/* (non-Javadoc)
	 * @see javax.servlet.ServletContextListener#contextDestroyed(javax.servlet.ServletContextEvent)
	 */
	public void contextDestroyed ( ServletContextEvent arg0 ) {
		// TODO Auto-generated method stub
	}
	
	/* (non-Javadoc)
	 * @see javax.servlet.ServletContextListener#contextInitialized(javax.servlet.ServletContextEvent)
	 */
	public void contextInitialized ( ServletContextEvent arg0 ) {
		// TODO Auto-generated method stub
		EhcacheContext.wc = arg0.getServletContext ( ).getInitParameter ( webAppRootKey ) ;
		EhcacheContext.ehcacheWc = arg0.getServletContext ( ).getRealPath ( "/" ) ; 
	}
	
}
